Class symantec.itools.multimedia.Animator
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.multimedia.Animator

Object
   |
   +----Component
           |
           +----Canvas
                   |
                   +----symantec.itools.multimedia.Animator

public class Animator
extends Canvas
implements Runnable, PropertyChangeListener
This is a simple animation component.
It creates an animation by displaying a series of images in sequence. The programmer can specify the delay between frames in milliseconds. The animation can loop for a specific number of iterations or can run forever.

Version:
1.0, Nov 26, 1996
Author:
Symantec

Variable Index

 o clearFrame
Clear frame between each image.
 o currentImage
Image currently being shown.
 o delay
Delay time between images, in milliseconds.
 o displayThread
Thread which runs the animation.
 o forever
Run animation forever.
 o images
Images to be displayed.
 o maxHeight
Dimension of largest image in sequence.
 o maxWidth
Dimension of largest image in sequence.
 o numLoops
Number of times to show the animation sequence.
 o previewMode
Preview this component at design time.

Constructor Index

 o symantec.itools.multimedia.Animator()
Constructs a default Animator.

Method Index

 o addImage(URL)
Adds an image to the animation set.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o getClearFrame()
 o getDelay()
Returns the current delay between animation frames.
 o getImageList()
Returns the image list.
 o getNumLoops()
Returns the current animation set loop count.
 o getPreviewMode()
 o getRepeatMode()
 o isClearFrame()
Gets the current clear frame setting.
 o isPreviewMode()
Gets the preview mode flag.
 o isRepeatMode()
Returns the current repeat mode setting.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o propertyChange(PropertyChangeEvent)
A method of the PropertyChangeListener interface.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o run()
Body of Animation Thread.
 o setClearFrame(boolean)
Sets whether or not the animation frame area is cleared between each frame.
 o setDelay(int)
Sets the delay between animation frames.
 o setImageList(URL[])
Sets the image list.
 o setNumLoops(int)
Sets the number of loops to perform when displaying the animation set.
 o setPreviewMode(boolean)
Sets the preview mode flag.
 o setRepeatMode(boolean)
Sets the repeat mode setting.
 o startAnimation()
Starts the animation.
 o stopAnimation()
Stops the animation.
 o update(Graphics)
Handles redrawing of this component on the screen.

Variables

 o clearFrame
protected boolean clearFrame
Clear frame between each image.

 o currentImage
protected transient java.awt.Image currentImage
Image currently being shown.

 o delay
protected int delay
Delay time between images, in milliseconds.

 o displayThread
protected transient java.lang.Thread displayThread
Thread which runs the animation.

 o forever
protected boolean forever
Run animation forever. If false, use numLoops.

 o images
protected java.util.Vector images
Images to be displayed.

 o maxHeight
protected int maxHeight
Dimension of largest image in sequence.

 o maxWidth
protected int maxWidth
Dimension of largest image in sequence.

 o numLoops
protected int numLoops
Number of times to show the animation sequence.

 o previewMode
protected boolean previewMode
Preview this component at design time.

Constructors

 o Animator
public Animator()
Constructs a default Animator. The animator defaults to a 500 millisecond delay, and loops forever.

Methods

 o addImage
public synchronized void addImage(URL url)
Adds an image to the animation set.

Parameters:
url - URL of the image to add
 o addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to add.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to add.
See Also:
removeVetoableChangeListener
 o getClearFrame
public boolean getClearFrame()
Note: getClearFrame() is deprecated.

See Also:
isClearFrame
 o getDelay
public int getDelay()
Returns the current delay between animation frames.

Returns:
current animation delay, in milliseconds
See Also:
setDelay
 o getImageList
public synchronized java.net.URL[] getImageList()
Returns the image list.

Returns:
URL list of images
See Also:
setImageList
 o getNumLoops
public int getNumLoops()
Returns the current animation set loop count.

Returns:
loop count
See Also:
setNumLoops
 o getPreviewMode
public boolean getPreviewMode()
Note: getPreviewMode() is deprecated.

See Also:
setPreviewMode
 o getRepeatMode
public boolean getRepeatMode()
Note: getRepeatMode() is deprecated.

See Also:
isRepeatMode
 o isClearFrame
public boolean isClearFrame()
Gets the current clear frame setting.

Returns:
boolean - if true, the frame area is cleared between each animation frame; if false, the frame area is not cleared.
See Also:
setClearFrame
 o isPreviewMode
public boolean isPreviewMode()
Gets the preview mode flag. This flag is used by Visual Cafe to determine if this component should be run during design time.

See Also:
setPreviewMode
 o isRepeatMode
public boolean isRepeatMode()
Returns the current repeat mode setting.

Returns:
current repeat mode setting, true if repeat forever
See Also:
setRepeatMode
 o minimumSize
public java.awt.Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Returns:
If no images have been loaded, a dimension of 10 by 10 is returned. If one or more images have been loaded, the largest height and the largest width of any image is returned.
Overrides:
minimumSize in class Component
See Also:
preferredSize
 o paint
public synchronized void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o preferredSize
public java.awt.Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Returns:
If no images have been loaded, a dimension of 10 by 10 is returned. If one or more images have been loaded, the largest height and the largest width of any image is returned.
Overrides:
preferredSize in class Component
See Also:
minimumSize
 o propertyChange
public void propertyChange(PropertyChangeEvent evt)
A method of the PropertyChangeListener interface. This method is called when a property of this component changes. It starts the animation when the Repeat Mode property is set.

Parameters:
evt - the event
See Also:
PropertyChangeListener
 o removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to remove.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to remove.
See Also:
addVetoableChangeListener
 o run
public synchronized void run()
Body of Animation Thread. This method is called by the Java Virtual Machine in response to a call to the start method of this object.

 o setClearFrame
public void setClearFrame(boolean newClearFrame) throws PropertyVetoException
Sets whether or not the animation frame area is cleared between each frame.

Parameters:
newClearFrame - if true, the frame area is cleared between each animation frame; if false, the frame area is not cleared.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getClearFrame
 o setDelay
public void setDelay(int newDelay) throws PropertyVetoException
Sets the delay between animation frames.

Parameters:
i - animation delay, in milliseconds
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getDelay
 o setImageList
public synchronized void setImageList(URL[] newImageList) throws PropertyVetoException
Sets the image list. Images in this list are displayed in sequence to form the animation.

Parameters:
list - array of image URLs
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getImageList
 o setNumLoops
public void setNumLoops(int newNumLoops) throws PropertyVetoException
Sets the number of loops to perform when displaying the animation set.

Parameters:
i - loop count
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getNumLoops
 o setPreviewMode
public void setPreviewMode(boolean newPreviewMode)
Sets the preview mode flag. This flag is used by Visual Cafe to determine if this component should be run during design time.

Parameters:
newPreviewMode - new preview mode
See Also:
getPreviewMode
 o setRepeatMode
public void setRepeatMode(boolean newRepeatMode) throws PropertyVetoException
Sets the repeat mode setting.

Parameters:
b - repeat mode, repeats if true
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getRepeatMode
 o startAnimation
public void startAnimation()
Starts the animation.

See Also:
stopAnimation
 o stopAnimation
public void stopAnimation()
Stops the animation.

See Also:
startAnimation
 o update
public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to make clearing the background before painting optional. If the clearFrame flag is true the background will be erased before painting begins.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint

All Packages  Class Hierarchy  This Package  Previous  Next  Index